import '../../../style/locationList.less';
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { withRouter } from 'react-router-dom';
import { Tools } from "weaver-mobile";
import { RouteLayout} from "weaver-mobile-page";
import TitlePage from '../../coms/TitlePage';
import MapView from './MapView';
import List from './List';
const getLabel = Tools.getLabel;

@inject('outSignStoreV2')
@inject('locationStore')
@withRouter
@observer
export default class LocationList extends Component {
    componentDidMount(){
        const {outSignStoreV2, locationStore} = this.props;
        locationStore.outSignStoreV2 = outSignStoreV2;
        const {hasLocationInfo} = outSignStoreV2;
        hasLocationInfo && locationStore.init();
    }

    render() {
        const {locationStore} = this.props;
        const {onBtnClickHandle} = locationStore;
        return (
            <RouteLayout>
                <div className='wm-route-layout'>
                    <TitlePage title={getLabel('504543','附近位置')}>
                        <div className='locationList'>
                            <MapView store={locationStore} />
                            <List store={locationStore} />
                            <div className='btn' onClick={() => onBtnClickHandle(() => this.props.history.go(-1))}>{getLabel('826','确定')}</div>
                        </div>
                    </TitlePage>
                </div>
            </RouteLayout>
        )
    }
}